Skip to content

Reviewer: answer replies to its findings without a mention; look up bucket and key settings instead of asking - #342

Merged
nambok merged 1 commit into
mainfrom
fix/reviewer-thread-replies
Oct 27, 2026
Merged

nambok merged 1 commit into
mainfrom
fix/reviewer-thread-replies

Conversation

@nambok

@nambok nambok commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

The reviewer asked a question on a person's pull request ("Is the source bucket encrypted with a customer-managed KMS key? ... a quick aws s3api get-bucket-encryption would settle it"). The author answered in that thread and nothing happened.

Why the reply was ignored. handle_review_comment sent a thread reply to the reviewer only when parse_reviewer_ask found @coderhelm or /coderhelm in the comment, and returned Ok with no log line otherwise. The only other path for a reply, the pushback judgment in review_lessons, counts only created events and only queues a lesson; it never answers. Edits also went through ask_added_by_edit, which returns early for anything but an edit that adds an ask. Every one of these exits was silent, so the gateway logs showed nothing after "GitHub webhook received". Separately, the "is it CoderHelm" checks matched any login containing coderhelm, so a person whose login contains that word was treated as the app.

This PR does two things:

  1. Replies in CoderHelm's own review threads are answered without a mention. The reviewer checks the thread is its own, acknowledges the answer in the thread, records the finding as answered, and resolves the thread when the answer settles it. If the app can't resolve it, the reply says so in one line. A settled finding while CoderHelm's verdict requests changes re-runs the formal review. A quote reply to CoderHelm's review in the PR conversation is handled the same way. Mentions work as before. Every dropped event now logs its reason.
  2. The reviewer looks things up instead of asking. Through the team's read-only AWS role it can now read an S3 bucket's default encryption, bucket policy and policy status, and a KMS key's description and key policy. When a finding depends on one of those facts it reads it first and cites the result. When AWS refuses, the review names the exact permission that's missing.

Changes

Gateway (routes/github_webhook.rs, routes/review_lessons.rs)

  • route_review_comment is a pure function that decides what to do with a pull_request_review_comment and gives a reason for every ignore. A reply in a thread (in_reply_to_id) on a person's PR goes to the worker as trigger thread_reply, with thread_root_id and mentioned, whether or not it mentions CoderHelm. A new top-level inline comment still needs the mention. On CoderHelm's own PRs nothing changes: thread replies there belong to the fix loop.
  • Replies from bots and from CoderHelm itself are ignored. CoderHelm is identified by the user type plus the app login (is_coderhelm_user), no longer by any login that contains the word.
  • Idempotency: the job key is thread#<comment id>#<fingerprint of the reply's words>. Mentions, quoted lines, punctuation and spacing are left out of the fingerprint. A duplicate delivery gets the same key. So does an edit that only adds a mention to a reply that was already answered, which is exactly the edit in this case. An edit that adds the answer gets a new key and is handled once. An edit that changes nothing in the words is ignored. This is the comment id plus a fingerprint rather than the comment id plus updated_at, because updated_at also changes on a mention-only edit and would answer twice.
  • issue_comment: a person's comment that quotes text (GitHub's "Quote reply") on a PR CoderHelm reviewed goes to the worker as quote_reply. Every early return now logs its reason.
  • review_lessons: an edited thread reply whose words changed now counts as pushback, so it feeds the lesson judgment. The two "not judged" exits now log their reason. reviewed_by_coderhelm is exposed for the quote path.

Worker

  • New passes/review_thread_reply.rs. It finds what the reply answers before the job is claimed: the CoderHelm thread whose first comment is the reply's root, or, for a quote, CoderHelm's thread, review or comment that contains the quoted text. A reply in someone else's thread that doesn't address CoderHelm is skipped with a log and leaves no claim, so a later edit that adds a mention is still handled. The module also builds the prompt (the finding, the thread so far, the answer), resolves the thread through GraphQL resolveReviewThread, and records the outcome under REVIEWANSWER#… (answered or settled, resolved, who, when).
  • review_pr.rs: the answer goes through the existing reply pipeline, which brings the same tools and the verdict reconciliation. When the answer settles a finding and the standing verdict is REQUEST_CHANGES, the formal review runs first. A thread CoderHelm resolved after a person's answer now counts as settled for re-reviews, so the concern isn't raised again.
  • review_agent.rs: the reply-conclusion check also returns settles_finding.
  • clients/github.rs: BotReviewThread.root_id (the first comment's databaseId).
  • ops_tools.rs: new tools aws_bucket_settings and aws_kms_key, available whenever an AWS account is connected. The prompt tells the reviewer to look these facts up first and to quote the missing permission when a lookup is refused. Lookups are recorded and cited like other lookups (T1, T2, …), and when every read in a lookup is refused, the lookup fails.

Common

  • New live/aws_settings.rs: input checks for buckets (name, s3:// or ARN) and keys (id, alias or ARN). The reads are GetBucketEncryption, GetBucketPolicy, GetBucketPolicyStatus, DescribeKey and GetKeyPolicy. A call made in the wrong region is retried in the region S3 names. Each read can come back as a value, absent, denied or failed. A denial is written up from the last permission check of the role: "the CoderHelmLogReader role is missing s3:GetEncryptionConfiguration … Update on the AWS page", or "the role allows it, so the resource's own policy refused it".
  • log_reader.rs: new ability settings ("Bucket and key settings"), described in plain words, metadata only. messages.rs: thread_root_id and mentioned on ReviewMessage. Both are skipped when empty, so the gateway-to-worker contract bytes don't change. Both tool registries list the two new tools as reads.

Infra

  • coderhelm-log-reader.yaml and coderhelm-log-reader-update.yaml each get a ReadBucketAndKeySettings statement with s3:GetEncryptionConfiguration, s3:GetBucketPolicy, s3:GetBucketPolicyStatus, kms:DescribeKey and kms:GetKeyPolicy. Neither template grants object reads, ListBucket, or encrypt or decrypt. Adding the actions changes the permissions id, so the release gets a new CoderHelmLogReaderUpdate-<id> stack and teams see "Update needed" on the AWS page until they apply it.

Verification

  • Tests with webhook fixtures (gateway/src/routes/testdata/): a reply without a mention is routed as a thread reply; a reply with a mention keeps its ask; an edited reply that adds the answer gets its own key; edits that only fix punctuation, or arrive without the old text, are ignored; a mention-only edit gets the key of the version already answered; replies from a bot and from CoderHelm are ignored, and a person whose login contains "coderhelm" is not; a duplicate delivery gets the same job key; deleted and empty comments are ignored with a reason.
  • Other new tests: the lesson trigger on edited replies, quote matching, thread lookup by root, the answer prompt, answered-and-resolved threads counting as settled, the bucket and key inputs, how each read can come back, the denial wording for each permission, account choice and the role check, and the ability and both templates covering the lookups' actions and nothing more (no object reads, no encrypt or decrypt).
  • cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace (common 1216, gateway 593, worker 767; all pass, after rebasing on main).
  • infra: npm test (77 pass), cfn-lint on both role templates (clean).

…ok up bucket and key settings instead of asking

A person's reply in a thread CoderHelm started was dropped unless it
mentioned CoderHelm, and every drop was silent. Thread replies on a
person's PR now go to the reviewer with or without a mention: it checks
the thread is its own, acknowledges the answer, records the finding as
answered, resolves the thread when the answer settles it, and re-runs the
formal review when that finding was holding the merge. Each version of a
reply's words is handled once. Every drop logs its reason.

The reviewer can now read an S3 bucket's encryption, bucket policy and
policy status, and a KMS key's description and key policy, through the
team's read-only role, and names the missing permission when refused.
The role templates and the update stack add those five read-only
actions.
@nambok
nambok merged commit 5eec5c3 into main Oct 27, 2026
8 checks passed
@nambok
nambok deleted the fix/reviewer-thread-replies branch October 27, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant